<html>

<head>

<title>Customer Registration</title>
<script>
function validatentn(){
var ntnempty = document.myForm.ntn;
var companyempty = document.myForm.company;
var contactempty = document.myForm.contact;
var addressempty = document.myForm.address;
var countryempty = document.myForm.country;
var cityempty = document.myForm.city;
var postalempty = document.myForm.postal;
var phoneempty = document.myForm.phone;

if (ntnempty.value == "")
    {
        window.alert("Empty ntn no field.");
        ntnempty.focus();
        return false;
    }

if (companyempty.value == "")
    {
        window.alert("Empty company name field.");
        companyempty.focus();
        return false;
    }
if (contactempty.value == "")
    {
        window.alert("Empty contact name field.");
        contactempty.focus();
        return false;
    }
if (addressempty.value == "")
    {
        window.alert("Empty address field.");
        addressempty.focus();
        return false;
    }  
if (countryempty.value == "")
    {
        window.alert("Empty country field.");
        countryempty.focus();
        return false;
    } 
if (cityempty.value == "")
    {
        window.alert("Empty city field.");
        cityempty.focus();
        return false;
    }
if (postalempty.value == "")
    {
        window.alert("Empty postal code field.");
        postalempty.focus();
        return false;
    } 
if (phoneempty.value == "")
    {
        window.alert("Empty phone no field.");
       phoneempty.focus();
        return false;
    } 
var regExp1 = /\D/g;
if(regExp1.test(document.myForm.postal.value)){
alert('Invalid Postal Code! \n\n Please enter a valid postal code.');
return;
}

var regExp2 = /\D/g;
if(regExp2.test(document.myForm.phone.value)){
alert('Invalid Phone number! \n\n Please enter a valid phone number.');
return;
}

document.myForm.submit();   
}

</script>


</head>

<body>
<form METHOD="POST" 
      ACTION="http://localhost:8080/myapp/registrationservlet"
      Name="myForm" onsubmit="return false;">
&nbsp;<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
  <tr>
    <td width="26%">&nbsp;</td>
    <td width="54%">
    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#C0C0C0" width="100%" id="AutoNumber2" bordercolorlight="#53524F" bordercolordark="#53524F" height="242">
      <tr>
        <td width="100%" background="menu.gif" height="23">
        <p align="center"><font face="Comic Sans MS" color="#53524F">Customer 
        Registration</font></td>
      </tr>
      <tr>
        <td width="100%" height="218">
        <table border="1" cellpadding="3" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber3" bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="168">
          <tr>
            <td width="36%" height="23"><font size="2" face="Arial">&nbsp;NTN # :</font></td>
            <td width="64%" height="23">
            <p align="center">&nbsp;<INPUT TYPE="text" name="ntn" size="27"></td>
          </tr>
          <tr>
            <td width="36%" height="23"><font face="Arial" size="2">&nbsp;Company name:</font></td>
            <td width="64%" height="23">
            <p align="center">&nbsp;<INPUT TYPE="text" name="company" size="27"></td>
          </tr>
          <tr>
            <td width="36%" height="23"><font face="Arial" size="2">&nbsp;Contact name:</font></td>
            <td width="64%" height="23">
            <p align="center">&nbsp;<INPUT TYPE="text" name="contact" size="27"></td>
          </tr>
          <tr>
            <td width="36%" height="23"><font face="Arial" size="2">&nbsp;Address:</font></td>
            <td width="64%" height="23">
            <p align="center">&nbsp;<INPUT TYPE="text" name="address" size="27"></td>
          </tr>
          <tr>
            <td width="36%" height="23"><font face="Arial" size="2">&nbsp;Country:</font></td>
            <td width="64%" height="23">
            <p align="center">&nbsp;<INPUT TYPE="text" name="country" size="27"></td>
          </tr>
          <tr>
            <td width="36%" height="23"><font face="Arial" size="2">&nbsp;City:</font></td>
            <td width="64%" height="23">
            <p align="center">&nbsp;<INPUT TYPE="text" name="city" size="27"></td>
          </tr>
          <tr>
            <td width="36%" height="23"><font face="Arial" size="2">Postal code:</font></td>
            <td width="64%" height="23">
            <p align="center"><INPUT TYPE="text" name="postal" size="27"></td>
          </tr>
          <tr>
            <td width="36%" height="23"><font face="Arial" size="2">&nbsp;Phone no:</font></td>
            <td width="64%" height="23">
            <p align="center">&nbsp;<INPUT TYPE="text" name="phone" size="27"></td>
          </tr>
          <tr>
            <th width="100%" colspan="2" height="2" rowspan="2" nowrap><font face="Arial" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>
            <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber4">
              <tr>
                <td width="100%"><font face="Arial" size="2">&nbsp;&nbsp;&nbsp; <INPUT TYPE="submit" value="Submit" size="27" onClick='validatentn();'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="reset" value="Reset"></font></td>
              </tr>
            </table>
            </th>
          </tr>
        </table>
        </td>
      </tr>
    </table>
    </td>
    <td width="20%">&nbsp;</td>
  </tr>
</table>
</form>
<div align="center">
  &nbsp;</div>

</body>

</html>